﻿<UserControl x:Class="WordsAsap.Pages.Settings.Appearance"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="VisibilityConverter" />
    </UserControl.Resources>
    
    <Grid>
        <ScrollViewer>
            <DockPanel>
            <StackPanel x:Name="Panel" MinWidth="150" DockPanel.Dock="Top">
                <TextBlock Text="APPEARANCE" Style="{StaticResource Heading2}" Margin="0,0,0,8" />

                <ListBox ItemsSource="{Binding AccentColors}"
                         SelectedItem="{Binding SelectedAccentColor, Mode=TwoWay}"
                         Margin="0,0,0,16">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel MaxWidth="{Binding ActualWidth, ElementName=Panel}" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Rectangle Width="40" Height="40" Margin="2" >
                                <Rectangle.Fill>
                                    <SolidColorBrush x:Name="Brush" Color="{Binding}" />
                                </Rectangle.Fill>
                            </Rectangle>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

                <Grid HorizontalAlignment="Left">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition MinWidth="120"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <TextBlock Text="Theme:" VerticalAlignment="Center" Margin="0,0,16,4" />
                    <ComboBox Grid.Column="1" ItemsSource="{Binding Themes}" SelectedItem="{Binding SelectedTheme, Mode=TwoWay}" DisplayMemberPath="DisplayName" VerticalAlignment="Center" Margin="0,0,0,4" />

                    <TextBlock Grid.Row="1" Text="Font size:" VerticalAlignment="Center" Margin="0,0,16,0" />
                    <ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding FontSizes}" SelectedItem="{Binding SelectedFontSize, Mode=TwoWay}" VerticalAlignment="Center" />
                    
                   

                </Grid>
            </StackPanel>

                <DockPanel DockPanel.Dock="Top" MinHeight="20"/>
                <CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowAddWordConfirmationDialog}" Content="Show confirmation dialog when adding new word" />
                
                <DockPanel DockPanel.Dock="Top" MinHeight="20"/>
                <DockPanel DockPanel.Dock="Top">
                    <mui:BBCodeBlock DockPanel.Dock="Left"   BBCode="[b]show word in:[/b]" VerticalAlignment="Center" TextAlignment="Right"/>
                    <ToggleButton DockPanel.Dock="Left" Width="Auto"  Height="22" Padding="1" Margin="5" Content="{Binding ShowWordInPopupOrDialog}" IsChecked="{Binding ShowWordInPopupDialog}"/>
                    <DockPanel DockPanel.Dock="Right" Width="25"/>
                </DockPanel>                
                
                <DockPanel DockPanel.Dock="Top" MinHeight="20"/>
                <DockPanel DockPanel.Dock="Top" Visibility="{Binding ShowWordInBalloonTip, Converter={StaticResource VisibilityConverter}}">
                    <mui:BBCodeBlock DockPanel.Dock="Left"   BBCode="[b]ballon tip transparency:[/b]" VerticalAlignment="Center" TextAlignment="Right"/>
                    <DockPanel DockPanel.Dock="Right" MinWidth="25"/>
                    <TextBox DockPanel.Dock="Right" 
                            Text="{Binding ElementName=ballooTipTransparencySlider, Path=Value, UpdateSourceTrigger=PropertyChanged}"                                      
                                     TextAlignment="Right" 
                                     VerticalAlignment="Center"
                                     Width="40" />
                    <CheckBox DockPanel.Dock="Bottom" 
                          Visibility="{Binding ShowWordInBalloonTip, Converter={StaticResource VisibilityConverter}}"
                          IsChecked="{Binding BalloonTipGradientOff}"
                          Content="Gradient off"
                          HorizontalAlignment="Left"/>
                    
                    <Slider Name="ballooTipTransparencySlider" 
                                Value="{Binding BalloonTipTransparency}"
                                Minimum="{Binding MinimumTransparency}"
                                Maximum="{Binding MaximumTransparency}"
                                SmallChange="{Binding SmallChange}"
                                LargeChange="{Binding LargeChange}"
                                TickPlacement="BottomRight" 
                                TickFrequency="0.01"
                                IsSnapToTickEnabled="True"
                                VerticalAlignment="Center"
                        />
                </DockPanel>
               
              
            </DockPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
